package com.uit3j.cloud.search.controller.platform;

import com.uit3j.cloud.api.dto.EsPageDTO;
import com.uit3j.cloud.api.dto.HotSearchDTO;
import com.uit3j.cloud.api.vo.EsPageVO;
import com.uit3j.cloud.api.vo.search.HotSearchVO;
import com.uit3j.cloud.common.response.ServerResponseEntity;
import com.uit3j.cloud.search.constant.SearchTypeEnum;
import com.uit3j.cloud.search.manager.HotSearchManager;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author tan
 * @Date 2024/7/17 16:48
 */
@RestController("platformHotSearchController")
@RequestMapping("/p/hotSearch")
@Tag(name = "platform-热搜管理列表接口")
public class HotSearchController {

    @Autowired
    private HotSearchManager hotSearchManager;

    @GetMapping("/page")
    @Operation(summary = "热搜管理信息列表（平台端）" , description = "热搜管理信息列表（平台端）")
    public ServerResponseEntity<EsPageVO<HotSearchVO>> adminPage(@Valid EsPageDTO pageDTO, HotSearchDTO hotSearchDTO) {
        hotSearchDTO.setSearchType(SearchTypeEnum.PLATFORM.value());
        EsPageVO<HotSearchVO> searchPage =  hotSearchManager.adminPage(pageDTO, hotSearchDTO);
        return ServerResponseEntity.success(searchPage);
    }
}
